﻿<!doctype html>
<html>
  <head>
    <meta charset = "utf-8" /> 
    <title> TEST! </title>
    <style>
      body {width:120mm; margin-left: auto;margin-right:auto;font-size:15pt;} 
    </style>
  </head>
<body>
<?php
if ( isset($_POST['number'],$_POST['dataa'],$_POST['name'],$_POST['s'])){
session_start();
$_POST['number'] = $_SESSION['number'];
$_POST['dataa'] = $_SESSION['dataa'];
$_POST['name'] = $_SESSION['name'];
$_POST['s'] = $_SESSION['s'];      
isset($l,$_POST['number'],$_POST['dataa'],$_POST['name'],$_POST['s'],$_POST['np'.$l.''],$_POST['vp'.$l.''],$_POST['vpp'.$l.'']);  
if(isset($_POST['number'],$_POST['dataa'],$_POST['name'],$_POST['s']))
{
  if($_POST['number'] !== '')
  { 
    if($_POST['dataa'] !== '')
    { 
      if($_POST['name'] !== '')
      { 
        echo '<form action="testphpforma2?page=test3" method="post">';
      }
    } 
  }
}
if($_POST['number'] == '')
{
  if($_POST['dataa'] == '')
  {
    if($_POST['name'] == '')
    {
      echo '<form action="testphpforma2?page=test1" method="post">';
    }
  }
}
}
?>
<table border="3" cellspacing="0" cellpadding="2" width="500">
  <form action="<?=$_SERVER['testphpforma2?page=test2.php']?>" name="page3"  method="post">
    <th>Ваш номер счёта,</th>
    <td>
<?php   
echo $number;
?><br>
    </td>
    <tr>
      <th>Дата,</th>
      <td>
<?php
echo $dataa;
?><br>
      </td>
    </tr>
    <th>Платильщик,</th>
    <td>
<?php 
echo $name; 
?><br>
    </td>
    <tr>
      <th>Наименование продукта,</th> <th>цена продукта</th>  
<?php  
for($k=1;$k<=10;$k++)
{
  $_POST['np'.$k.''] = null; $_POST['vp'.$k.''] = null; $_POST['vpp'.$k.''] = null;
}
  if (isset($_POST['s']))
  {
    for ($l=1;$l<=$_POST['s'];$l++)
    {   
      echo  '<tr>','<td>',
'<input required type="text" size="35" maxlength="255" name="np'.$l.'" value="'.$_POST['np'.$l.''].'" >','</td>','<td id="t1">',
'<input required type="text" onkeypress="event.returnValue=(event.keyCode > 47) && (event.keyCode  < 58) " pattern="\d+"  size="15" name="vp'.$l.'" value="'.$_POST['vp'.$l.''].'" placeholder="Руб">',
'<input type="text" onkeypress="event.returnValue=(event.keyCode > 47) && (event.keyCode  < 58) " pattern="\d+{2}" size="1" name="vpp'.$l.'" value="'.$_POST['vpp'.$l.''].'" placeholder="Коп" maxlength="2">','</td>','</tr>';    
    }  
  }
?>

    </tr>
</table>
<br>
  <input type="submit">
</form>
</body>
</html>

          